package com.wn26.service.impl;

import java.sql.SQLException;

import com.wn26.bean.User;
import com.wn26.dao.UserDao;
import com.wn26.dao.impl.UserDaoImpl;
import com.wn26.service.UserService;

public class UserServiceImpl implements UserService {
	
	private UserDao ud;
	
	public UserServiceImpl() {
		ud = new UserDaoImpl();
	}

	@Override
	public User userLogin(String userName, String userPwd) throws SQLException {
		return ud.findUserByUserNameAndPwd(userName,userPwd);
	}

	@Override
	public boolean userRegister(User registerUser) throws SQLException {
		return ud.saveUser(registerUser) != 0;
	}

	@Override
	public boolean checkTelExists(String user_tel) throws SQLException {
		//-- 为true 表示手机号存在 为false 表示手机号不存在!!
		return ud.findUserByTel(user_tel) != null;
	}

}
